home *** CD-ROM | disk | FTP | other *** search
/ Software Vault: The Gold Collection / Software Vault - The Gold Collection (American Databankers) (1993).ISO / cdr50 / qbmnus16.zip / HORZSAMP.BAS < prev    next >
BASIC Source File  |  1993-03-14  |  2KB  |  63 lines

  1. DECLARE SUB HorizontalMenu (tr%, bc%, fc%)
  2. CLS
  3. HorizontalMenu 1, 1, 7
  4. '              │  │  └───┐
  5. '             tr% └─fc%  bc%
  6. '          ──────────────────────────────────────────
  7. ' Tr%:
  8. ' Location of row for first line of menu
  9. '          ──────────────────────────────────────────
  10. ' Fc%:
  11. ' Foreground color (Pick any color from 1 to 15)
  12. '          ──────────────────────────────────────────
  13. ' Bc%:
  14. ' Background color (Pick any color from 1 to 15)
  15. '          ──────────────────────────────────────────
  16.  
  17. SUB HorizontalMenu (tr%, bc%, fc%)
  18. COLOR fc%, bc%
  19. LOCATE tr%, 1: PRINT STRING$(80, 0)
  20. 'background for menu
  21. LOCATE tr%, 1: PRINT SPACE$(3); "FILES"; SPACE$(5); "TOOLS"; SPACE$(5); "SCAN"; SPACE$(6); "KILL"; SPACE$(6); "NAME"; SPACE$(6); "LOOKUP"; SPACE$(4); "WRITE"; SPACE$(5); "EXIT"
  22. 'menu items and correct spacing
  23. col = 4 ' preset of first menu item
  24. DO
  25. DO
  26. SELECT CASE col
  27. CASE 4: opt$ = "FILES"    'This section needed to reprint
  28. CASE 14: opt$ = "TOOLS"   'menu items after widebar selector
  29. CASE 24: opt$ = "SCAN"    'passes over them
  30. CASE 34: opt$ = "KILL"
  31. CASE 44: opt$ = "NAME"
  32. CASE 54: opt$ = "LOOKUP"
  33. CASE 64: opt$ = "WRITE"
  34. CASE 74: opt$ = "EXIT"
  35. END SELECT
  36. LOCATE tr%, col, 0: COLOR bc%, fc%: PRINT opt$
  37. 'sets spacing of widebar selector
  38. keys$ = INKEY$
  39. LOOP WHILE keys$ = ""
  40. keymove = ASC(RIGHT$(keys$, 1)) 'interprets scancodes
  41. LOCATE tr%, col, 0: COLOR fc%, bc%: PRINT opt$
  42. 'resets menu items and color after widebar selector passes over them
  43. SELECT CASE keymove
  44. CASE 13
  45. IF col = 4 THEN END
  46. IF col = 14 THEN END   'edit out "END" and place in your own code
  47. IF col = 24 THEN END   'to call subprograms, etc.
  48. IF col = 34 THEN END
  49. IF col = 44 THEN END
  50. IF col = 54 THEN END
  51. IF col = 64 THEN END
  52. IF col = 74 THEN END
  53. CASE 75: col = col - 10  'moves widebar selector ahead 10 cols
  54. CASE 77: col = col + 10  'moves widebar selector back 10 cols
  55. CASE 71: col = 74        'shortcut keys
  56. CASE 79: col = 74        'shortcut keys
  57. END SELECT
  58. IF col < 4 THEN col = 74 ELSE IF col > 74 THEN col = 4 'limits range of widebar
  59. LOOP
  60. END
  61. END SUB
  62.  
  63.